package com.ash.test.datasource;

import java.sql.SQLException;

import javax.sql.DataSource;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MySpringTestDataSource {

	@Test
	public void test() throws SQLException {
		// 使用"spring.xml"和"spring-mybatis.xml"这两个配置文件创建Spring上下文
		ApplicationContext ac = new ClassPathXmlApplicationContext(new String[] { "beans-datasource.xml" });

		DataSource p = (DataSource) ac.getBean("dataSource");
		System.out.println(p.getConnection());

	}

}
